<?php

/**
 * MlIncidentsVersion form base class.
 *
 * @method MlIncidentsVersion getObject() Returns the current form's model object
 *
 * @package    maslogger
 * @subpackage form
 * @author     Michaël VEROUX
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseMlIncidentsVersionForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                => new sfWidgetFormInputHidden(),
      'machine_id'        => new sfWidgetFormInputText(),
      'version_id'        => new sfWidgetFormInputText(),
      'intervention'      => new sfWidgetFormTextarea(),
      'solution'          => new sfWidgetFormTextarea(),
      'photo'             => new sfWidgetFormTextarea(),
      'pieces_remplaces'  => new sfWidgetFormTextarea(),
      'controler'         => new sfWidgetFormInputCheckbox(),
      'sfm'               => new sfWidgetFormInputCheckbox(),
      'controler_do'      => new sfWidgetFormInputCheckbox(),
      'sfm_do'            => new sfWidgetFormInputCheckbox(),
      'priorite'          => new sfWidgetFormChoice(array('choices' => array('A faire' => 'A faire', 'Fait' => 'Fait'))),
      'presence_id'       => new sfWidgetFormInputText(),
      'intervention_date' => new sfWidgetFormDateTime(),
      'created_by'        => new sfWidgetFormInputText(),
      'updated_by'        => new sfWidgetFormInputText(),
      'created_at'        => new sfWidgetFormDateTime(),
      'updated_at'        => new sfWidgetFormDateTime(),
      'version'           => new sfWidgetFormInputHidden(),
    ));

    $this->setValidators(array(
      'id'                => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'machine_id'        => new sfValidatorInteger(),
      'version_id'        => new sfValidatorInteger(),
      'intervention'      => new sfValidatorString(array('required' => false)),
      'solution'          => new sfValidatorString(array('required' => false)),
      'photo'             => new sfValidatorString(array('required' => false)),
      'pieces_remplaces'  => new sfValidatorString(array('required' => false)),
      'controler'         => new sfValidatorBoolean(array('required' => false)),
      'sfm'               => new sfValidatorBoolean(array('required' => false)),
      'controler_do'      => new sfValidatorBoolean(array('required' => false)),
      'sfm_do'            => new sfValidatorBoolean(array('required' => false)),
      'priorite'          => new sfValidatorChoice(array('choices' => array(0 => 'A faire', 1 => 'Fait'), 'required' => false)),
      'presence_id'       => new sfValidatorInteger(),
      'intervention_date' => new sfValidatorDateTime(),
      'created_by'        => new sfValidatorInteger(array('required' => false)),
      'updated_by'        => new sfValidatorInteger(array('required' => false)),
      'created_at'        => new sfValidatorDateTime(),
      'updated_at'        => new sfValidatorDateTime(),
      'version'           => new sfValidatorChoice(array('choices' => array($this->getObject()->get('version')), 'empty_value' => $this->getObject()->get('version'), 'required' => false)),
    ));

    $this->widgetSchema->setNameFormat('ml_incidents_version[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'MlIncidentsVersion';
  }

}
